package com.example.studykt.entity

import android.os.Parcel
import android.os.Parcelable

class Databus() : Parcelable {

    /**
     * sms主要结构：
     * _id：短信序号，如100
     * address：发件人地址，即手机号，如+8613811810000
     * person：发件人，如果发件人在通讯录中则为具体姓名，陌生人为null
     * date：日期，long型，如1256539465022，可以对日期显示格式进行设置
     * type：短信类型1是接收到的，2是已发出
     * body：短信具体内容
     *
     */

    var _id: String? = null
    var address: String? = null
    var person: String? = null
    var date: String? = null
    var type: String? = null
    var body: String? = null

    constructor(parcel: Parcel) : this() {
        _id = parcel.readString()
        address = parcel.readString()
        person = parcel.readString()
        date = parcel.readString()
        type = parcel.readString()
        body = parcel.readString()
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(_id)
        parcel.writeString(address)
        parcel.writeString(person)
        parcel.writeString(date)
        parcel.writeString(type)
        parcel.writeString(body)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<Databus> {
        override fun createFromParcel(parcel: Parcel): Databus {
            return Databus(parcel)
        }

        override fun newArray(size: Int): Array<Databus?> {
            return arrayOfNulls(size)
        }
    }

}
